// Token
const tokenKey = 'portal_access_token'
// Name
const nameKey = 'portal_access_name'

// vue
new Vue({
  el: '#headerContainer',
  data: {
    portal_url: VUE_APP_CLIENT_PORTAL_URL,
    manage_url: VUE_APP_CLIENT_MANAGE_URL,
    qiniu_url: VUE_APP_SERVER_QINIU_URL,
    userName: Cookies.get(nameKey) || '',
	uToken: Cookies.get(tokenKey) || ''
  },
  methods: {
    /**
     * 退出登录
     */
    handleLogout() {
		Cookies.remove(tokenKey)
        Cookies.remove(nameKey)
      if (VUE_APP_SERVER_DOMAIN) {
        Cookies.remove(tokenKey, { domain: VUE_APP_SERVER_DOMAIN })
        Cookies.remove(nameKey, { domain: VUE_APP_SERVER_DOMAIN })
      } else {
        Cookies.remove(tokenKey)
        Cookies.remove(nameKey)
      }
      window.location.href = `${this.portal_url}/index.html`
    }
  }
})
